package org.ttjhome.db.dbo;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;

@Entity
@Table(name="Tags")
@Cacheable(value=true)
public class Tag implements Serializable {

	
	public long getCount() {
		return count;
	}


	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column
    private Long id;
	
	@Version
	private int version;
	
	@Column
	private String tag;
	
	@ManyToMany
    private Set<Candidate> candidates = new HashSet<Candidate>();
	
	@ManyToMany
    private Set<Job> jobs = new HashSet<Job>();
	
	@Transient
	private long count;
	
	
	public Tag() {
		
	}
	public Tag(String tag, long count	){
		this.tag = tag;
		this.count = count;
	}
	public void setCount(long count) {
		this.count = count;
	}
	public Set<Candidate> getCandidates() {
		return candidates;
	}

	public void setCandidates(Set<Candidate> candidates) {
		this.candidates = candidates;
	}

	public Set<Job> getJobs() {
		return jobs;
	}

	public void setJobs(Set<Job> jobs) {
		this.jobs = jobs;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getTag() {
		return tag;
	}
	
	public void setTag(String tag){
		this.tag = tag;
	}
	
	
	public String toString() {
		return this.tag;
	}
	
	
}
